package com.zzti.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zzti.dao.EmployeeDao;
import com.zzti.pojo.Employee;

@WebServlet("/FindEmployee")
public class FindEmployeeServlet extends HttpServlet {

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html; charset=UTF-8");
		// 调用数据层进行员工信息的查询
		EmployeeDao employeeDao = new EmployeeDao();
		List<Employee> list = employeeDao.queryEmployeeAll();
		request.setAttribute("empList", list);
		request.getRequestDispatcher("showEmployee.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
